package com.ecity.net {
	import com.ecity.events.GameEvent;
	import flash.events.EventDispatcher;
	import flash.events.ProgressEvent;
	/**
	 * ...
	 * @author yicheng.zhang
	 */
	public class Delegate extends EventDispatcher{
		
		private var conn:Connector;
		private static const HOST:String ="127.0.0.1";

		private static const PORT:int = 8888;
		
		//****************public Style****************/
			public static const START_GAME:String ="startGame";
			public static const START_PLAY:String ="startPlay";
			public static const MOUSE_DATA:String ="mouseData";
			public static const MOUSE_MOVE:String ="mouseMove";
		//****************public Style****************/
		
		
		public function Delegate(){
			conn = new Connector(HOST, PORT);
			conn.addEventListener(ProgressEvent.SOCKET_DATA,onSocketDataHandler);
		}
		
		private function onSocketDataHandler(e:ProgressEvent):void {
			this.dispatchEvent(new GameEvent(GameEvent.DATA_TRANSLATED,{command:START_GAME}));
		}
		
	}

}